import React from 'react';
import ReactDOM from 'react-dom';
import { createStore,applyMiddleware } from 'redux';
import { Provider } from 'react-redux';
import { Router,browserHistory } from 'react-router';
import { syncHistoryWithStore} from 'react-router-redux';
import thunk from 'redux-thunk';
import reducers from './reducers/index';
import './static/css/style.less';


const store = createStore(
  reducers,
  applyMiddleware(thunk)
);

const history = syncHistoryWithStore(browserHistory, store);
import routes from './routes/index'

const render = () => {
  ReactDOM.render(
    <Provider store={store}>
      <Router history={history}>
        {routes}
      </Router>
    </Provider>,
    document.getElementById('App')
  );
};

//console.log(store.getState());

//设置监听
store.subscribe(render);
render();